﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace UMLDesigner
{
    public partial class ParametersWindow : Form
    {
        Boolean modify=false;
        public ParametersWindow()
        {
            InitializeComponent();
            listBoxType.DataSource = DataType.types;
        }

        public ParametersWindow(ParameterData p)
            : this()
        {
            modify = true;
            textBoxName.Text = p.GetName();
            listBoxType.Text = p.GetParamType();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            Close();
        }

        private void btnAccept_Click(object sender, EventArgs e)
        {
            if (!modify)
            {
                MethodsWindow v = (MethodsWindow)Owner;
                v.AddParameter(textBoxName.Text, listBoxType.Text);
            }
            else
            {

                MethodsWindow v = (MethodsWindow)Owner;
                v.ModifyParameter(textBoxName.Text, listBoxType.Text);
            }
            this.Close();
        }
    }
}
